﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using SDM.ExamPlanner.DALC;
using SDM.ExamPlanner.DTO;

namespace SDM.ExamPlanner.Test
{
    [TestClass]
    public class SchoolClassTest : BaseTest
    {
        [TestMethod]
        public void AddSchoolClassTest()
        {
            // Assign
            var schoolClassRepository = new DataRepository<SchoolClass>();

            // Act
            schoolClassRepository.RegisterNew(TestObjects.SchoolClassObject1());
            schoolClassRepository.SaveChanges();
            var schoolClasses = schoolClassRepository.Find();

            // Assert
            Assert.AreEqual(1, schoolClasses.Count());
        }

        [TestMethod]
        public void GetAllSchoolClassTest()
        {
            // Assign
            var schoolClassRepository = new DataRepository<SchoolClass>();

            // Act
            schoolClassRepository.RegisterNew(TestObjects.SchoolClassObject1());
            schoolClassRepository.RegisterNew(TestObjects.SchoolClassObject2());
            schoolClassRepository.SaveChanges();
            var schoolClasses = schoolClassRepository.Find();

            // Assert
            Assert.AreEqual(2, schoolClasses.Count());
        }
    }
}
